import java.util.HashMap;
import java.util.Map;

/**
 * @author dale
 * @date 2021/9/22 19:55
 */
public class EchoL0702 {

    public static void main(String[] args){
        int []data={1,2,3,4,5,5,4,3,6,7,1};
        Map<Integer,Integer> map=new HashMap<>();
        for (Integer i:data){
            map.put(i,i);
        }
        //返回与之指定值相关联的键
        System.out.println(map.keySet());
        //返回与指定值相关联的键
        System.out.println(map.values());
        for (Integer key: map.keySet()){
            System.out.println("key= "+ key +"and value= " +map.get(key));
        }
        //去重后的map转化成数组输出
        int[] temp=new int[map.size()];
        int i=0;
        for (Integer key: map.keySet()){
            temp[i]=map.get(key);
            i++;
        }
        for (int j = 0; j < temp.length; j++) {
            System.out.println(temp[j] + " ");
        }
        System.out.println(" ");
    }
}
